package com.app.admin.controller;

import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ModelAttribute;

// 全局控制器通知，对所有控制器生效
@ControllerAdvice
public class GlobalController {

    // 每次请求都会将当前 URI 存入模型，键为 "currentUri"
    @ModelAttribute("currentUri")
    public String getCurrentUri(HttpServletRequest request) {
        return request.getRequestURI();
    }
}
